package com.tanhua.app.controller;

import com.tanhua.app.controllerservice.SoulTestService;
import com.tanhua.domain.mongo.Answer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class SoulTestController {
    @Autowired
    private SoulTestService soulTestService;
    @PostMapping("/testSoul")
    public ResponseEntity testSoul(@RequestBody Map<String, List<Answer>> map){

        List<Answer> answers = map.get("answers");

        return soulTestService.testSoul(answers);
    }
    @GetMapping("/testSoul/report/{pid}")
    public ResponseEntity report(@PathVariable String pid){
        return soulTestService.report(pid);
    }
    @GetMapping("/testSoul")
    public ResponseEntity soulQuestion(){
        return soulTestService.soulQuestion();
    }

}
